<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>二维码管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
	$(document).ready(function(){
		$("#buttonId").bind("click","saveLeaderToGroup");		
	});
	</script>
	<script type="text/javascript">
			var ids =[];
			var type;
			var groupId;
		 function saveLeader(){
			 type=$('#type').val();
			 groupId=$("#groupId").val();
			 $('input[name="ids"]:checked').each(function(){    
				   ids.push($(this).val());    
				  }); 
			 window.location.href="${ctx}/app/mmsGroup/saveGroupMember?ids="+ids+"&"+"groupId="+groupId+"&"+"type="+type;
		 };
			 
		 function page(n,s){
			 	if(n) $("#pageNo").val(n);
				if(s) $("#pageSize").val(s);
				$("#searchForm").attr("action","${ctx}/app/mmsGroup/memberList");
				$("#searchForm").submit();
		    	return false;
		    }
		 function selectAll(){  
			    if ($("#SelectAll").attr("checked")) {  
			        $(":checkbox").attr("checked", true);  
			    } else {  
			        $(":checkbox").attr("checked", false);  
			    }  
			}  
		 
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/app/mmsGroup/list">组列表</a></li>
		<li><a href="${ctx}/app/mmsGroup/memberListInGroup?groupId=${groupId }&activeId=${activeId }">组成员</a></li>
		<li class="active"><a href="${ctx}/app/mmsGroup/addMember?groupId=${groupId }&activeId=${activeId }">添加成员</a></li>
	</ul><br/>
	<form:form id="searchForm" action="${ctx}/app/mmsGroup/memberList" method="post" class="breadcrumb form-search ">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}" callback="page();"/>
		<input id="remarks" name="remarks" type="hidden" value="addMember"/>
		<input id="activeId" name="activeId" type="hidden" value="${activeId }"/>
		<input id="groupId" name="groupId" type="hidden" value="${groupId }"/>
		<ul class="ul-form">
			<li><label>用戶名：</label><input id="loginName" name="loginName" maxlength="50" class="input-medium" value="${loginName}"/></li>
			<li><label>姓名：</label><input id="name" name="name" maxlength="50" class="input-medium" value="${name }"/></li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" onclick="return page();"/>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead><tr><th><input type="checkbox" value="全选" id="SelectAll" onclick="selectAll();"/></th><th class="sort-column id">ID</th><th class="sort-column name">用户名</th><th>姓名</th><th>手机号</th></tr></thead>
		<tbody>
		<input type="hidden" name="type" id="type" value="1"/>
		<input type="hidden" name="groupId" id="groupId" value="${groupId}"/>
		<c:forEach items="${page.list}" var="user">
			<tr>
				<td><input type="checkbox" name="ids" id="suerId" value="${user.id }"/></td>
				<td>${user.id }</td>
				<td>${user.loginName}</td>
				<td>${user.name}</td>
				<td>${user.mobile}</td>
				<%-- <td>
					<a href="${ctx}/mms/user/groupLeader?id=${user.id}" onclick="return confirmx('确认要设置为组长吗？', this.href)">置为组长</a>
				</td> --%>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
	<div class="form-actions">
			<button  onclick="saveLeader()">添加成员</button>
	</div>
</body>
</html>